<template>
    <div class="mui-numbox"  data-numbox-min='1' style="height:25px">
      <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
      <input class="mui-numbox-input" type="number" :value="initCount"
      @change="countChanged" ref="numbox" readonly/>
      <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
    </div>
</template> 

<script>
import mui from '../../lib/mui/js/mui.min.js'
export default {

  data () {
    return {
    }
  },

  methods: {
      countChanged(){
        // console.log(this.$refs.numbox.value);
        
      // this.$emit("getcount",parseInt(this.$refs.numbox.value))
      this.$store.commit('updateGoodsInfo',{
        id:this.goodsid,
        count:this.$refs.numbox.value })
    }
  },

  created () {
      
  },
  mounted() {
    mui('.mui-numbox').numbox()
    
  },
  props:['initCount','goodsid']
}
</script>

<style lang='less' scoped>
</style>
